package wortubung.inflection;

import wortubung.core.LANG;
import wortubung.util.ImmutableStringList;

import static wortubung.util.CommonUtils.neverNull;

public class InflectionError {

	public static final ImmutableStringList titles =
			new ImmutableStringList("Verb", "Type", "Person", "Expected", "Actual");

	private String verb;
	private Object type;
	private PERSON person;
	private Object expected;
	private Object actual;

	public InflectionError(String verb, Object type, PERSON person, Object expected, Object actual) {
		super();
		this.verb = verb;
		this.type = type;
		this.person = person;
		this.expected = expected;
		this.actual = actual;
	}

	public String getVerb() { return verb; }
	public Object getType() { return type; }
	public PERSON getPerson() { return person; }
	public Object getExpected() { return expected; }
	public Object getActual() { return actual; }
	
	public String[] toStringArray(LANG lang) {
		String p = person == null ? "" : person.getName(lang);
		return new String[] {
				verb,
				neverNull(type),
				p,
				neverNull(lang.toLatin(String.valueOf(expected), true)),
				neverNull(lang.toLatin(String.valueOf(actual), true))
		};
	}
}
